package csc.fresher.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import csc.fresher.dao.CustomerDao;
import csc.fresher.dao.DepositAccountDao;
import csc.fresher.dao.SavingAccountDao;
import csc.fresher.entity.Customer;
import csc.fresher.entity.DepositAccount;
import csc.fresher.entity.SavingAccount;

@Service
public class AccountServiceImpl implements AccountService {

	@Autowired
	private CustomerDao customerDao;
	
	@Autowired
	private DepositAccountDao depositAccountDao;
	
	@Autowired
	private SavingAccountDao savingAccountDao;
	
	@Override
	public long createCustomer(Customer customer) {
		return customerDao.createCustomer(customer);
	}

	@Override
	public long createDepositAccount(DepositAccount depositAccount) {
		return depositAccountDao.create(depositAccount);
	}

	@Override
	public long createSavingAccount(SavingAccount savingAccount) {
		return savingAccountDao.insert(savingAccount);
	}
	@Override
	public List<Customer> findCustomerByIDCardNumber(long idCardNumber){
		return customerDao.getCustomerByCardNumberID(idCardNumber);
	}

	@Override
	public boolean updateCustomer(Customer customer) {
		return customerDao.updateCustomer(customer);		
	}

	@Override
	public Customer getCustomerByID(long customerID) {
		return customerDao.getCustomerByID(customerID);
	}
}
